package com.tadpole.music.holder.me;

import android.annotation.SuppressLint;
import android.view.View;
import android.widget.TextView;

import com.tadpole.music.R;
import com.tadpole.music.bean.me.MyPointListBean;
import com.tadpole.music.holder.base.BaseViewHolder;

import java.util.List;

/**
 * Created By 孙岩
 * on 2021/1/10
 */
public class MyPointsViewHolder extends BaseViewHolder {
    private View itemView;
    private List<MyPointListBean.DataBeanX.DataBean> list;
    //名称
    private TextView tvName;
    //时间
    private TextView tvTime;
    //状态
    private TextView tvState;

    public MyPointsViewHolder(View itemView,List<MyPointListBean.DataBeanX.DataBean> list) {
        super(itemView);
        this.itemView = itemView;
        this.list = list;
    }

    @SuppressLint("SetTextI18n")
    @Override
    public void init(int position) {
        tvName = itemView.findViewById(R.id.tvName);
        tvTime = itemView.findViewById(R.id.tvTime);
        tvState = itemView.findViewById(R.id.tvState);

        if(list.get(position).isIncr()){
            tvState.setText("+"+list.get(position).getNum());
        }else{
            tvState.setText("-"+list.get(position).getNum());
        }

        tvName.setText(list.get(position).getSource_alias());

        tvTime.setText(list.get(position).getCreated_at());
    }
}
